import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooMinishopOrderController } from '../../../controllers';
const uctoominishopOrderRouter = new Router();
const minishopOrderController = new uctooMinishopOrderController();

uctoominishopOrderRouter.post('/add', requireUser, minishopOrderController.add);
uctoominishopOrderRouter.post('/edit', requireUser, rowLevelPermission('uctoo/minishop_order'), minishopOrderController.edit);
uctoominishopOrderRouter.post('/del', requireUser, rowLevelPermission('uctoo/minishop_order'), minishopOrderController.delete);

//For getting minishopOrder with permission control
uctoominishopOrderRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/minishop_order'), minishopOrderController.getSingle);
uctoominishopOrderRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/minishop_order'), minishopOrderController.getMany);
uctoominishopOrderRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/minishop_order'), minishopOrderController.getMany);

//#endregion AutoCreateCode
uctoominishopOrderRouter.get('/createVmcOrderQrcode',  minishopOrderController.createVmcOrderQrcode);
uctoominishopOrderRouter.post('/createUserOrder', requireUser, minishopOrderController.createUserOrder);
uctoominishopOrderRouter.get('/count', minishopOrderController.countOrders);
uctoominishopOrderRouter.post('/createUserEventOrder', requireUser, minishopOrderController.createUserEventOrder);
uctoominishopOrderRouter.post('/handleOrderFinalPrice', requireUser, minishopOrderController.handleOrderFinalPrice);
export default uctoominishopOrderRouter;
